﻿using Blog.Model.Entitys;
using Blog.Model;
using Microsoft.AspNetCore.Mvc;
using Blog.Model.Dto.Tag;

namespace Blog.WebApi.Controllers
{
    [ApiController]
    [Route("api/[controller]/[action]")]
    public class TagController : Controller
    {
        private ITagService _TagService;

        public TagController(ITagService tagService)
        {
            this._TagService = tagService;
        }

        /// <summary>
        /// 获取标签列表
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        [HttpGet]
        public ApiResult TagList(int pageIndex,int pageSize)
        {
            var param = new ListParam();
            param.PageIndex = 1;
            param.PageSize = 10;

            return _TagService.TagList(param);
        }

        /// <summary>
        /// 无参获取标签
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public ApiResult TagPrintenvList()
        {
            return _TagService.TagPrintenvList();
        }

        [HttpPost]
        public ApiResult AddTag(TagAdd param)
        {
            if (param == null)
                return new ApiResult().Error("参数列表为空");
            return _TagService.AddTag(param);
        }
    }
}
